package com.spddr.pmos.jpa;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.joda.time.LocalDate;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Entity
@Table(name = "unit_info")
public class Unit extends PowerSystemResource {
	private static final long serialVersionUID = 1L;

	private Plant plant;
	private LocalDate joinDate;
	private LocalDate bizDate;
	private Double baseP;
	private Double initialP;
	private Double nominalP;
	private Double minEconomicP;
	private Double maxEconomicP;
	private Double lowerRampRate;
	private Double raiseRampRate;
	private Double stepChange;

	public Unit() {
		super();
	}

	public Unit(Long id) {
		super(id);
	}

	public Unit(Long id, String name) {
		super(id, name);
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "plant", nullable = false)
	@JsonSerialize(using = cn.seqdata.jackson.ObjectSerializer.IdName.class)
	public Plant getPlant() {
		return this.plant;
	}

	public void setPlant(Plant plant) {
		this.plant = plant;
	}

	@Column(name = "join_date", length = 10)
	@Convert(converter = cn.seqdata.jpa.converter.LocalDateConverter.class)
	public LocalDate getJoinDate() {
		return this.joinDate;
	}

	public void setJoinDate(LocalDate joinDate) {
		this.joinDate = joinDate;
	}

	@Column(name = "biz_date", length = 10)
	@Convert(converter = cn.seqdata.jpa.converter.LocalDateConverter.class)
	public LocalDate getBizDate() {
		return this.bizDate;
	}

	public void setBizDate(LocalDate bizDate) {
		this.bizDate = bizDate;
	}

	@Column(name = "base_p")
	public Double getBaseP() {
		return this.baseP;
	}

	public void setBaseP(Double baseP) {
		this.baseP = baseP;
	}

	@Column(name = "initial_p")
	public Double getInitialP() {
		return this.initialP;
	}

	public void setInitialP(Double initialP) {
		this.initialP = initialP;
	}

	@Column(name = "nominal_p")
	public Double getNominalP() {
		return this.nominalP;
	}

	public void setNominalP(Double nominalP) {
		this.nominalP = nominalP;
	}

	@Column(name = "min_economic_p")
	public Double getMinEconomicP() {
		return this.minEconomicP;
	}

	public void setMinEconomicP(Double minEconomicP) {
		this.minEconomicP = minEconomicP;
	}

	@Column(name = "max_economic_p")
	public Double getMaxEconomicP() {
		return this.maxEconomicP;
	}

	public void setMaxEconomicP(Double maxEconomicP) {
		this.maxEconomicP = maxEconomicP;
	}

	@Column(name = "lower_ramp_rate")
	public Double getLowerRampRate() {
		return this.lowerRampRate;
	}

	public void setLowerRampRate(Double lowerRampRate) {
		this.lowerRampRate = lowerRampRate;
	}

	@Column(name = "raise_ramp_rate")
	public Double getRaiseRampRate() {
		return this.raiseRampRate;
	}

	public void setRaiseRampRate(Double raiseRampRate) {
		this.raiseRampRate = raiseRampRate;
	}

	@Column(name = "step_change")
	public Double getStepChange() {
		return this.stepChange;
	}

	public void setStepChange(Double stepChange) {
		this.stepChange = stepChange;
	}
}